< previous page page_54 next page >

Page 54
frmDialog form. Several changes will be made to this code for the enhanced functions. Listing 2.1 shows what the routine should look like.
Caution
Remember that you are starting with the project that you created in Chapter 1. The FileProcess routine will reference the same controls as before.

LISTING 2.1. FILEPROCESS.BASTHE FILE PROCESS ROUTINE FOR COPYING AND MOVING A SELECTED FILE.

8694cbadb9b1ef7075903f6f95fc1db2.gif
 1: Private Sub FileProcess (FileAction As Interger)
 2:
 3:  Set the file path for the animation file
 4:  Set the from and to file copy paths
 5:     strAvi_Filename = c:\program _
        files\devstudio\vb\graphics\avis\filecopy.avi
 6:     strFrom_filename = txtSourceFile.Text
 7:     strTo_filename = txtTargetFile.Text
 8:
 9: add FileSystemObject code here
10:
11:  Get the size of the file to copy
12:  and calculate the number of times to loop
13:  the copy routine based on moving 256 bytes at a time
14:     lngFileSize = FileLen (strFrom_filename)
15:     intBufferCount = lngFileSize / 256
16:
17:  Set the progressbar min and max properties
18:     frmStatus.prgStatus.Min = 1
19:     frmStatus.prgStatus.Max = intBufferCount + 1
20:
21:  Open the avi file
22:     frmStatus.anmShowAction.Open strAvi_Filename
23:
24:  Open the source and destination files
25:     Open strFrom_filename For Binary As #1
26:     Open strTo_filename For Binary As #2
27:
28:  Set the label to display the file being copied
29:  and make all of the related controls visible
30:     If FileAction = ActionCopy Then
31:         frmStatus.lblDisplay.Caption = Copying..  & strFrom_filename
32:     Else
33:         frmStatus.lblDisplay.Caption = Moving..  & strFrom_filename
34:     End If
35:     frmStatus.Show

 
< previous page page_54 next page >

If you like this book, buy it!